<!--
 * @Description: 
 * @Author: charles
 * @Date: 2021-05-05 22:02:56
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-01-07 15:26:22
-->

<template>
  <!--1. 容器 -->
  <div ref="left1_container" style="height: 85%"></div>
</template>

<script>

import { Line } from '@antv/g2plot';
// import { get } from '../../../../../am-app/src/utils/request';

export default {
  data() {
    return {
      dataArr: [
        { year: "1991", value: 3 },
        { year: "1992", value: 4 },
        { year: "1993", value: 3.5 },
        { year: "1994", value: 5 },
        { year: "1995", value: 4.9 },
        { year: "1996", value: 6 },
        { year: "1997", value: 7 }
      ],
    };
  },
  //生命周期钩子函数
  created() {},
  mounted() {
    this.initChart()
  },
  methods: {
    initChart() {
      //3.创建一个折线图实例对象
      const line = new Line(this.$refs.left1_container, {
        data: this.dataArr,
        xField: "year",
        yField: "value",
      });

      //4.渲染图像
      line.render();
    },
  },
};
</script>

<style scoped>

</style>
